#ifndef _NALU_PARSE_H_
#define _NALU_PARSE_H_
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef FRAME_MAX_NALU_COUNT
#define FRAME_MAX_NALU_COUNT (16)
#endif

typedef enum{
    LIBRTSP_VIDEO_H264 = 0,
    LIBRTSP_VIDEO_H265 = 1,
    LIBRTSP_VIDEO_HEVC = LIBRTSP_VIDEO_H265,
}LIBRTSP_VIDEO_TYPE;

typedef enum{
    NaluFalse = 0x0,
    NaluTrue = 0x1
}LibRtspBoolean;

typedef struct
{
    int type;                       // 0 -- h.264; 1 -- h.265
    unsigned int num;               // 序号
    unsigned int len;               // 含起始码的总的长度
    unsigned int offset;            // nal包在文件中的偏移
    int startcodeLen;               // start code长度
}LibRtspNALU_t;

typedef struct _StreamNaluInfo
{
    LibRtspNALU_t nalus[FRAME_MAX_NALU_COUNT];
    uint32_t count;
}LibRtspNalus;

char LibRtsp_keyframe(int type, const uint8_t *in, size_t size, int32_t *startLen_);
char LibRtsp_configFrame(int type, const uint8_t *in, size_t size, int32_t *startLen_);
char LibRtsp_dropAble(int type, const uint8_t *in, size_t size, int32_t *startLen_);
char LibRtsp_decodeAble(int type, const uint8_t *in, size_t size, int32_t *startLen_);
char LibRtsp_separateFrame(int type, const void* data, size_t size, LibRtspNalus *nalus);
#ifdef __cplusplus
}
#endif

#endif // NALU_PARSE_H_